#include"priority_queue.h"

void test1()
{
	cyq::priority_queue<int,vector<int>,cyq::Less<int>> pq;

	pq.push(1);
	pq.push(2);
	pq.push(3);
	pq.push(4);
	pq.push(5);
	pq.push(6);

	while (!pq.empty())
	{
		cout << pq.top() << " ";
		pq.pop();
	}
	cout << endl;

}

void test2()
{
	cyq::priority_queue<int, vector<int>, cyq::Greater<int>> pq;

	pq.push(1);
	pq.push(2);
	pq.push(3);
	pq.push(4);
	pq.push(5);
	pq.push(6);

	while (!pq.empty())
	{
		cout << pq.top() << " ";
		pq.pop();
	}
	cout << endl;

}

class Date
{
public:
	Date(int year = 1900, int month = 1, int day = 1)
		: _year(year)
		, _month(month)
		, _day(day)
	{}
	bool operator<(const Date& d)const
	{
		return (_year < d._year) ||
			(_year == d._year && _month < d._month) ||
			(_year == d._year && _month == d._month && _day < d._day);
	}
	bool operator>(const Date& d)const
	{
		return (_year > d._year) ||
			(_year == d._year && _month > d._month) ||
			(_year == d._year && _month == d._month && _day > d._day);
	}
	bool operator!=(const Date& d)const
	{
		return _year != d._year && _month != d._month && _day != d._day;
	}
	friend ostream& operator<<(ostream& _cout, const Date& d);
private:
	int _year;
	int _month;
	int _day;
};

ostream& operator<<(ostream& _cout, const Date& d)
{
	_cout << d._year << "-" << d._month << "-" << d._day;
	return _cout;
}

void test3()
{
	
	cyq::priority_queue<Date, vector<Date>, cyq::Less<Date>> pq;

	pq.push(Date(2024,7,29));
	pq.push(Date(2024, 6, 26));
	pq.push(Date(2024, 8, 29));
	

	while (!pq.empty())
	{
		cout << pq.top() << " ";
		pq.pop();
	}
	cout << endl;

}

void test4()
{
	cyq::priority_queue<Date*, vector<Date*>, cyq::GreaterDate<Date*>> pq;
	//cyq::priority_queue<Date*, vector<Date*>, cyq::LessDate<Date*>> pq;

	pq.push(new Date(2024, 7, 29));
	pq.push(new Date(2024, 6, 26));
	pq.push(new Date(2024, 8, 29));


	while (!pq.empty())
	{
		cout <<* pq.top() << " ";
		pq.pop();
	}
	cout << endl;
}


int main()
{
	test1();
	cout << "--------------------------------" << endl;

	test2();
	cout << "--------------------------------" << endl;

	test3();
	cout << "--------------------------------" << endl;

	test4();
	cout << "--------------------------------" << endl;

	return 0;
}